From 2ea95750b6480ad827a7f19e54278f6acd6931d3 Mon Sep 17 00:00:00 2001 From: Jimi Xenidis Date: Sun, 21 Jan 2007 07:49:50 -0500 Subject: [PATCH] [XEN][POWERPC] Allocate secondary VCPUs for Dom0 Signed-off-by: Jimi Xenidis --HG-- extra : transplant_source : %1B%00%E1%28%8E%8C%A3v%D2gF%28%B1%BF%FFi%84C%DB%F2 --- xen/arch/powerpc/domain_build.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xen/arch/powerpc/domain_build.c b/xen/arch/powerpc/domain_build.c index 0f283678f8..f13186548a 100644 --- a/xen/arch/powerpc/domain_build.c +++ b/xen/arch/powerpc/domain_build.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -120,6 +121,7 @@ int construct_dom0(struct domain *d, ulong msr; ulong pc; ulong r2; + int vcpu; /* Sanity! */ BUG_ON(d->domain_id != 0); @@ -210,6 +212,27 @@ int construct_dom0(struct domain *d, /* put stack below everything */ v->arch.ctxt.gprs[1] = dst - STACK_FRAME_OVERHEAD; + /* startup secondary processors */ + if ( opt_dom0_max_vcpus == 0 ) + opt_dom0_max_vcpus = num_online_cpus(); + if ( opt_dom0_max_vcpus > num_online_cpus() ) + opt_dom0_max_vcpus = num_online_cpus(); + if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS ) + opt_dom0_max_vcpus = MAX_VIRT_CPUS; +#ifdef BITS_PER_GUEST_LONG + if ( opt_dom0_max_vcpus > BITS_PER_GUEST_LONG(d) ) + opt_dom0_max_vcpus = BITS_PER_GUEST_LONG(d); +#endif + printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus); + + for (vcpu = 1; vcpu < opt_dom0_max_vcpus; vcpu++) { + if (NULL == alloc_vcpu(dom0, vcpu, vcpu)) + panic("Error creating domain 0 vcpu %d\n", vcpu); + /* for now we pin Dom0 VCPUs to their coresponding CPUs */ + if (cpu_isset(vcpu, cpu_online_map)) + dom0->vcpu[vcpu]->cpu_affinity = cpumask_of_cpu(vcpu); + } + /* copy relative to Xen */ dst += rma; -- 2.30.2